package com.flca.frw.validator
{
	import mx.validators.Validator;
	import mx.validators.ValidationResult;
	import com.flca.frw.util.ConversionUtil;
	import mx.controls.Alert;
	import mx.controls.TextInput;

/*
exmple how to use:
	<vld:ComboboxValidator id="vldWoonsituatie" source="{cbWoonsituatie}" property="text" required="true" enabled="false"/>
*/
	public class CheckboxValidator extends Validator
	{
		[Inspectable]
		public var highlight : TextInput;
		
		private var results:Array;

		public function CheckboxValidator() 
		{
			super();
		}
		
	    override protected function doValidation(value : Object):Array 
	    {
		    // Clear results Array.
		    results = [];
		
		    // Call base class doValidation().
		    if ((value as Boolean) == false) {
		    	if (highlight != null) {
		    		highlight.text = '*';
		    		highlight.visible = true;
		    	}
		    	results.push("Veld moet worden aangevinkt");		    	
		        return results;
		    }
		    
	    	if (highlight != null) {
	    		highlight.text = '';
	    		highlight.visible = false;
	    	}

		    return results;
		}
	}
}

